'use strict';

/**
 * @description 地区表模型
 * */
module.exports = app => {
  const { STRING, INTEGER } = app.Sequelize;

  const Area = app.model.define('area', {
    name: {
      type: STRING(20),
      allowNull: false,
      comment: '地区名',
    },
    level: {
      type: INTEGER,
      allowNull: false,
      comment: '地区等级',
    },
    parentId: {
      type: INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: '父元素id',
    },
  });

  return Area;
};
